import { LineLayer, PolygonLayer, Scene } from '@antv/l7';
import { DrawPolygon } from '@antv/l7-draw';
import { GaodeMap } from '@antv/l7-maps';
import { Feature, featureCollection } from '@turf/turf';
import { Button } from 'antd';
import 'antd/dist/antd.css';
import React, { useEffect, useState } from 'react';

const id = String(Math.random());

const Demo: React.FC = () => {
  const [polygonDrawer, setPolygonDrawer] = useState<DrawPolygon | null>(null);

  useEffect(() => {
    const scene = new Scene({
      id,
      map: new GaodeMap({
        center: [120.151634, 30.244831],
        pitch: 0,
        style: 'dark',
        zoom: 10,
      }),
    });
    scene.on('loaded', () => {
      const adsorbFeatures: Feature[] = [
        {
          type: 'Feature',
          properties: {
            adcode: 130000,
            name: '河北省',
            center: [114.502461, 38.045474],
            childrenNum: 11,
            level: 'province',
            parent: { adcode: 100000 },
            subFeatureIndex: 2,
            acroutes: [100000],
          },
          geometry: {
            type: 'MultiPolygon',
            coordinates: [
              [
                [
                  [117.467487, 40.649738],
                  [117.412669, 40.605226],
                  [117.429915, 40.576141],
                  [117.389879, 40.561593],
                  [117.348611, 40.581141],
                  [117.348611, 40.581141],
                  [117.269771, 40.560684],
                  [117.247597, 40.539766],
                  [117.262995, 40.512927],
                  [117.208793, 40.501552],
                  [117.263611, 40.442367],
                  [117.234046, 40.417312],
                  [117.226039, 40.368997],
                  [117.243285, 40.369453],
                  [117.271618, 40.325211],
                  [117.271618, 40.325211],
                  [117.295024, 40.2782],
                  [117.331365, 40.289613],
                  [117.351075, 40.229786],
                  [117.389879, 40.227958],
                  [117.415748, 40.248973],
                  [117.450241, 40.252627],
                  [117.505059, 40.227044],
                  [117.548791, 40.232527],
                  [117.571581, 40.219276],
                  [117.576508, 40.178593],
                  [117.609769, 40.160301],
                  [117.609769, 40.160301],
                  [117.613465, 40.158014],
                  [117.613465, 40.158014],
                  [117.651653, 40.122786],
                  [117.651653, 40.122786],
                  [117.654117, 40.114548],
                  [117.654117, 40.114548],
                  [117.655965, 40.109514],
                  [117.655965, 40.109514],
                  [117.675059, 40.082045],
                  [117.71879, 40.082045],
                  [117.71879, 40.082045],
                  [117.752667, 40.081588],
                  [117.776073, 40.059605],
                  [117.74774, 40.047236],
                  [117.744044, 40.018368],
                  [117.768681, 40.022034],
                  [117.768681, 40.022034],
                  [117.793319, 40.005534],
                  [117.793319, 40.005534],
                  [117.795167, 39.996823],
                  [117.795167, 39.996823],
                  [117.781616, 39.966558],
                  [117.781616, 39.966558],
                  [117.756363, 39.965181],
                  [117.691073, 39.984902],
                  [117.671363, 39.973896],
                  [117.614697, 39.97252],
                  [117.594987, 39.994531],
                  [117.594987, 39.994531],
                  [117.546327, 39.999116],
                  [117.534625, 39.954631],
                  [117.514914, 39.946832],
                  [117.513067, 39.910576],
                  [117.513067, 39.910576],
                  [117.512451, 39.90874],
                  [117.512451, 39.90874],
                  [117.508139, 39.901854],
                  [117.508139, 39.901854],
                  [117.529081, 39.859144],
                  [117.529081, 39.859144],
                  [117.561726, 39.799856],
                  [117.546327, 39.775943],
                  [117.56111, 39.754782],
                  [117.595603, 39.74604],
                  [117.57774, 39.726711],
                  [117.627015, 39.703693],
                  [117.668899, 39.666849],
                  [117.66274, 39.636437],
                  [117.637486, 39.603246],
                  [117.654117, 39.575113],
                  [117.684914, 39.58895],
                  [117.707088, 39.576036],
                  [117.715711, 39.529892],
                  [117.745276, 39.547892],
                  [117.753899, 39.579726],
                  [117.753899, 39.579726],
                  [117.766834, 39.598635],
                  [117.829659, 39.589873],
                  [117.868464, 39.59679],
                  [117.933753, 39.574191],
                  [117.904804, 39.533585],
                  [117.912195, 39.517428],
                  [117.912195, 39.517428],
                  [117.899877, 39.474479],
                  [117.870311, 39.455074],
                  [117.871543, 39.411625],
                  [117.846906, 39.407926],
                  [117.852449, 39.380639],
                  [117.805022, 39.373237],
                  [117.810565, 39.354729],
                  [117.850601, 39.363984],
                  [117.850601, 39.363984],
                  [117.854297, 39.328348],
                  [117.854913, 39.328348],
                  [117.854297, 39.328348],
                  [117.854913, 39.328348],
                  [117.88879, 39.332051],
                  [117.919587, 39.318162],
                  [117.919587, 39.318162],
                  [117.965782, 39.314921],
                  [117.965782, 39.314921],
                  [117.973173, 39.312143],
                  [117.973173, 39.312143],
                  [117.979333, 39.300566],
                  [117.979333, 39.300566],
                  [117.982412, 39.298714],
                  [117.982412, 39.298714],
                  [118.024296, 39.289451],
                  [118.024296, 39.289451],
                  [118.036615, 39.264898],
                  [118.064948, 39.256094],
                  [118.064948, 39.231065],
                  [118.034767, 39.218548],
                  [118.026144, 39.201854],
                  [118.070492, 39.213911],
                  [118.077883, 39.201854],
                  [118.12531, 39.182838],
                  [118.162883, 39.136433],
                  [118.1906, 39.080708],
                  [118.225092, 39.034701],
                  [118.319331, 39.009594],
                  [118.366143, 39.016104],
                  [118.377845, 38.971917],
                  [118.491178, 38.909077],
                  [118.539837, 38.910008],
                  [118.604511, 38.971452],
                  [118.570634, 38.999363],
                  [118.533062, 39.090928],
                  [118.588497, 39.107648],
                  [118.578642, 39.130863],
                  [118.637156, 39.157319],
                  [118.76096, 39.133648],
                  [118.814546, 39.138754],
                  [118.857662, 39.162888],
                  [118.897082, 39.151286],
                  [118.920488, 39.171703],
                  [118.951285, 39.178662],
                  [118.896466, 39.139683],
                  [118.890307, 39.118792],
                  [118.926031, 39.123435],
                  [118.97777, 39.163352],
                  [119.023966, 39.187012],
                  [119.038132, 39.211593],
                  [119.096031, 39.24219],
                  [119.121284, 39.281576],
                  [119.185342, 39.342234],
                  [119.272805, 39.363521],
                  [119.317153, 39.4107],
                  [119.316537, 39.437051],
                  [119.269726, 39.498497],
                  [119.366428, 39.734996],
                  [119.474217, 39.813189],
                  [119.536427, 39.809052],
                  [119.520413, 39.840306],
                  [119.540739, 39.888079],
                  [119.588166, 39.910576],
                  [119.620195, 39.904609],
                  [119.642369, 39.925264],
                  [119.681789, 39.922511],
                  [119.726137, 39.940867],
                  [119.787115, 39.950502],
                  [119.820375, 39.979399],
                  [119.842549, 39.956007],
                  [119.872114, 39.960594],
                  [119.854252, 39.98857],
                  [119.845629, 40.000949],
                  [119.845629, 40.000949],
                  [119.854252, 40.033033],
                  [119.81668, 40.050443],
                  [119.81668, 40.050443],
                  [119.787115, 40.041739],
                  [119.787115, 40.041739],
                  [119.783419, 40.046778],
                  [119.783419, 40.046778],
                  [119.772332, 40.08113],
                  [119.736608, 40.104936],
                  [119.760629, 40.136056],
                  [119.745847, 40.207851],
                  [119.716898, 40.195966],
                  [119.671934, 40.23938],
                  [119.639289, 40.231613],
                  [119.639289, 40.231613],
                  [119.651608, 40.271808],
                  [119.598021, 40.334335],
                  [119.586934, 40.375381],
                  [119.604797, 40.455119],
                  [119.553674, 40.502007],
                  [119.572152, 40.523846],
                  [119.559217, 40.547952],
                  [119.503783, 40.553864],
                  [119.477913, 40.533399],
                  [119.429254, 40.540221],
                  [119.30237, 40.530215],
                  [119.256175, 40.543404],
                  [119.22045, 40.569322],
                  [119.230921, 40.603863],
                  [119.177951, 40.609315],
                  [119.162552, 40.600228],
                  [119.14469, 40.632482],
                  [119.184726, 40.680153],
                  [119.165632, 40.69286],
                  [119.115125, 40.666536],
                  [119.054763, 40.664721],
                  [119.028277, 40.692406],
                  [119.011031, 40.687414],
                  [118.96114, 40.72008],
                  [118.950053, 40.747743],
                  [118.895234, 40.75409],
                  [118.907553, 40.775394],
                  [118.878604, 40.783098],
                  [118.845959, 40.822057],
                  [118.873061, 40.847866],
                  [118.90201, 40.960946],
                  [118.916792, 40.969984],
                  [118.977154, 40.959138],
                  [118.977154, 40.959138],
                  [119.00056, 40.967273],
                  [119.013495, 41.007479],
                  [118.951901, 41.018317],
                  [118.937118, 41.052625],
                  [118.964836, 41.079246],
                  [119.037516, 41.067516],
                  [119.080632, 41.095936],
                  [119.081248, 41.131555],
                  [119.126212, 41.138767],
                  [119.189038, 41.198234],
                  [119.169943, 41.222996],
                  [119.204436, 41.222546],
                  [119.209364, 41.244599],
                  [119.2494, 41.279689],
                  [119.239545, 41.31431],
                  [119.211827, 41.308016],
                  [119.197661, 41.282837],
                  [119.168712, 41.294978],
                  [119.092951, 41.293629],
                  [118.980234, 41.305769],
                  [118.949437, 41.317906],
                  [118.890923, 41.300823],
                  [118.844727, 41.342622],
                  [118.843496, 41.374516],
                  [118.770199, 41.352956],
                  [118.741866, 41.324198],
                  [118.677192, 41.35026],
                  [118.629765, 41.346666],
                  [118.528135, 41.355202],
                  [118.412338, 41.331838],
                  [118.380309, 41.312062],
                  [118.348896, 41.342622],
                  [118.361215, 41.384844],
                  [118.348896, 41.428384],
                  [118.327338, 41.450816],
                  [118.271904, 41.471446],
                  [118.315636, 41.512688],
                  [118.302701, 41.55256],
                  [118.215237, 41.59554],
                  [118.206614, 41.650566],
                  [118.159187, 41.67605],
                  [118.155491, 41.712694],
                  [118.132702, 41.733241],
                  [118.140093, 41.784134],
                  [118.178281, 41.814917],
                  [118.236179, 41.80778],
                  [118.247266, 41.773869],
                  [118.29223, 41.772976],
                  [118.335346, 41.845241],
                  [118.340273, 41.87243],
                  [118.268824, 41.930336],
                  [118.306396, 41.940131],
                  [118.313788, 41.98819],
                  [118.291614, 42.007759],
                  [118.239875, 42.024655],
                  [118.286686, 42.033991],
                  [118.296541, 42.057545],
                  [118.27252, 42.083312],
                  [118.239259, 42.092639],
                  [118.212774, 42.081091],
                  [118.220165, 42.058434],
                  [118.194296, 42.031324],
                  [118.116687, 42.037102],
                  [118.155491, 42.081091],
                  [118.097593, 42.105072],
                  [118.089586, 42.12283],
                  [118.106216, 42.172082],
                  [118.033535, 42.199132],
                  [117.977485, 42.229716],
                  [117.974405, 42.25054],
                  [118.047702, 42.280656],
                  [118.060021, 42.298364],
                  [118.008898, 42.346595],
                  [118.024296, 42.385064],
                  [117.997811, 42.416884],
                  [117.874007, 42.510038],
                  [117.856761, 42.539148],
                  [117.797631, 42.585431],
                  [117.801326, 42.612744],
                  [117.779768, 42.61847],
                  [117.708935, 42.588515],
                  [117.667051, 42.582347],
                  [117.60053, 42.603054],
                  [117.537088, 42.603054],
                  [117.530313, 42.590278],
                  [117.475494, 42.602613],
                  [117.435458, 42.585431],
                  [117.434226, 42.557224],
                  [117.387415, 42.517537],
                  [117.387415, 42.517537],
                  [117.410205, 42.519743],
                  [117.413284, 42.471645],
                  [117.390495, 42.461933],
                  [117.332596, 42.46105],
                  [117.332596, 42.46105],
                  [117.275314, 42.481797],
                  [117.275314, 42.481797],
                  [117.188467, 42.468114],
                  [117.188467, 42.468114],
                  [117.135496, 42.468996],
                  [117.09546, 42.484004],
                  [117.080061, 42.463699],
                  [117.080061, 42.463699],
                  [117.01662, 42.456193],
                  [117.01662, 42.456193],
                  [117.009228, 42.44957],
                  [117.009228, 42.44957],
                  [117.005533, 42.43367],
                  [117.005533, 42.43367],
                  [116.99075, 42.425719],
                  [116.99075, 42.425719],
                  [116.974736, 42.426603],
                  [116.974736, 42.426603],
                  [116.97104, 42.427486],
                  [116.97104, 42.427486],
                  [116.944555, 42.415116],
                  [116.944555, 42.415116],
                  [116.936547, 42.410256],
                  [116.936547, 42.410256],
                  [116.921765, 42.403628],
                  [116.921765, 42.403628],
                  [116.910062, 42.395231],
                  [116.910062, 42.395231],
                  [116.910678, 42.394789],
                  [116.910678, 42.394789],
                  [116.886656, 42.366496],
                  [116.897743, 42.297479],
                  [116.918685, 42.229716],
                  [116.903287, 42.190708],
                  [116.789338, 42.200462],
                  [116.825062, 42.155669],
                  [116.850316, 42.156556],
                  [116.890352, 42.092639],
                  [116.879881, 42.018431],
                  [116.796113, 41.977958],
                  [116.748686, 41.984186],
                  [116.727744, 41.951259],
                  [116.66923, 41.947698],
                  [116.639049, 41.929891],
                  [116.597165, 41.935679],
                  [116.553433, 41.928555],
                  [116.510933, 41.974399],
                  [116.4826, 41.975734],
                  [116.453651, 41.945917],
                  [116.393289, 41.942802],
                  [116.414231, 41.982407],
                  [116.373579, 42.009983],
                  [116.310137, 41.997086],
                  [116.298434, 41.96817],
                  [116.223906, 41.932562],
                  [116.212819, 41.885352],
                  [116.194341, 41.861734],
                  [116.122892, 41.861734],
                  [116.106877, 41.831419],
                  [116.129051, 41.805996],
                  [116.09887, 41.776547],
                  [116.034196, 41.782795],
                  [116.007095, 41.79752],
                  [116.007095, 41.797966],
                  [116.007095, 41.79752],
                  [116.007095, 41.797966],
                  [115.994776, 41.828743],
                  [115.954124, 41.874213],
                  [115.916552, 41.945027],
                  [115.85311, 41.927665],
                  [115.834632, 41.93835],
                  [115.811226, 41.912525],
                  [115.726227, 41.870202],
                  [115.688038, 41.867528],
                  [115.654162, 41.829189],
                  [115.57409, 41.80555],
                  [115.519887, 41.76762],
                  [115.488474, 41.760924],
                  [115.42996, 41.728775],
                  [115.346808, 41.712247],
                  [115.319091, 41.691693],
                  [115.360975, 41.661297],
                  [115.345576, 41.635807],
                  [115.377605, 41.603148],
                  [115.310468, 41.592854],
                  [115.290142, 41.622835],
                  [115.26612, 41.616124],
                  [115.256881, 41.580768],
                  [115.20391, 41.571367],
                  [115.195287, 41.602253],
                  [115.0992, 41.62373],
                  [115.056085, 41.602253],
                  [115.016049, 41.615229],
                  [114.860832, 41.60091],
                  [114.895325, 41.636255],
                  [114.902716, 41.695715],
                  [114.89594, 41.76762],
                  [114.868839, 41.813579],
                  [114.922426, 41.825175],
                  [114.939056, 41.846132],
                  [114.923658, 41.871093],
                  [114.915035, 41.960605],
                  [114.9021, 42.015763],
                  [114.860832, 42.054879],
                  [114.86268, 42.097967],
                  [114.825723, 42.139695],
                  [114.79431, 42.149457],
                  [114.789383, 42.130819],
                  [114.75489, 42.115727],
                  [114.675434, 42.12061],
                  [114.647717, 42.109512],
                  [114.560254, 42.132595],
                  [114.510978, 42.110844],
                  [114.502355, 42.06732],
                  [114.480181, 42.064654],
                  [114.467863, 42.025989],
                  [114.511594, 41.981962],
                  [114.478334, 41.951704],
                  [114.419203, 41.942356],
                  [114.352066, 41.953484],
                  [114.343443, 41.926774],
                  [114.282465, 41.863517],
                  [114.200545, 41.789934],
                  [114.215328, 41.75646],
                  [114.206704, 41.7386],
                  [114.237501, 41.698843],
                  [114.215328, 41.68499],
                  [114.259059, 41.623282],
                  [114.226414, 41.616572],
                  [114.221487, 41.582111],
                  [114.230726, 41.513584],
                  [114.101379, 41.537779],
                  [114.032394, 41.529715],
                  [113.976959, 41.505966],
                  [113.953553, 41.483553],
                  [113.933227, 41.487139],
                  [113.919677, 41.454404],
                  [113.877793, 41.431076],
                  [113.871017, 41.413126],
                  [113.94493, 41.392477],
                  [113.92522, 41.325546],
                  [113.899351, 41.316108],
                  [113.914749, 41.294529],
                  [113.95109, 41.282837],
                  [113.971416, 41.239649],
                  [113.992357, 41.269794],
                  [114.016379, 41.231999],
                  [113.996669, 41.19238],
                  [113.960945, 41.171211],
                  [113.920293, 41.172112],
                  [113.877793, 41.115777],
                  [113.819279, 41.09774],
                  [113.868554, 41.06887],
                  [113.973263, 40.983087],
                  [113.994821, 40.938798],
                  [114.057647, 40.925234],
                  [114.041633, 40.917546],
                  [114.055183, 40.867782],
                  [114.073661, 40.857372],
                  [114.044712, 40.830661],
                  [114.080437, 40.790348],
                  [114.104458, 40.797597],
                  [114.103227, 40.770861],
                  [114.134639, 40.737314],
                  [114.162357, 40.71373],
                  [114.183299, 40.67153],
                  [114.236269, 40.607043],
                  [114.283081, 40.590685],
                  [114.273842, 40.552954],
                  [114.293552, 40.55159],
                  [114.282465, 40.494725],
                  [114.267066, 40.474242],
                  [114.299711, 40.44009],
                  [114.286161, 40.425057],
                  [114.31203, 40.372645],
                  [114.381015, 40.36307],
                  [114.390254, 40.351213],
                  [114.438914, 40.371733],
                  [114.481413, 40.34802],
                  [114.530688, 40.345283],
                  [114.510978, 40.302851],
                  [114.46971, 40.268155],
                  [114.406269, 40.246232],
                  [114.362537, 40.249886],
                  [114.292936, 40.230242],
                  [114.255364, 40.236182],
                  [114.235654, 40.198252],
                  [114.180219, 40.191395],
                  [114.135871, 40.175392],
                  [114.097683, 40.193681],
                  [114.073046, 40.168533],
                  [114.073046, 40.168533],
                  [114.101995, 40.099901],
                  [114.086596, 40.071513],
                  [114.045944, 40.056856],
                  [114.018227, 40.103563],
                  [113.989278, 40.11226],
                  [113.959097, 40.033491],
                  [113.910438, 40.015618],
                  [114.029314, 39.985819],
                  [114.028082, 39.959218],
                  [114.047176, 39.916085],
                  [114.067502, 39.922511],
                  [114.17406, 39.897722],
                  [114.212248, 39.918839],
                  [114.229494, 39.899558],
                  [114.204241, 39.885324],
                  [114.215943, 39.8619],
                  [114.286776, 39.871087],
                  [114.285545, 39.858225],
                  [114.395182, 39.867412],
                  [114.406885, 39.833413],
                  [114.390254, 39.819165],
                  [114.41674, 39.775943],
                  [114.409964, 39.761683],
                  [114.408117, 39.652106],
                  [114.431522, 39.613851],
                  [114.49558, 39.608318],
                  [114.51529, 39.564964],
                  [114.568877, 39.573729],
                  [114.532536, 39.486027],
                  [114.501739, 39.476789],
                  [114.496812, 39.438437],
                  [114.469095, 39.400989],
                  [114.466631, 39.329736],
                  [114.430906, 39.307513],
                  [114.437066, 39.259337],
                  [114.416124, 39.242654],
                  [114.47587, 39.21623],
                  [114.443841, 39.174023],
                  [114.388406, 39.176807],
                  [114.360689, 39.134112],
                  [114.369928, 39.107648],
                  [114.345907, 39.075133],
                  [114.252284, 39.073739],
                  [114.180835, 39.049111],
                  [114.157429, 39.061194],
                  [114.10877, 39.052364],
                  [114.082901, 39.09325],
                  [114.082901, 39.09325],
                  [114.064422, 39.094179],
                  [114.050872, 39.135969],
                  [114.006524, 39.122971],
                  [113.994821, 39.095572],
                  [113.961561, 39.100681],
                  [113.930148, 39.063517],
                  [113.898119, 39.067699],
                  [113.80696, 38.989595],
                  [113.776779, 38.986804],
                  [113.76754, 38.959819],
                  [113.776163, 38.885788],
                  [113.795257, 38.860628],
                  [113.855619, 38.828933],
                  [113.836525, 38.795824],
                  [113.839605, 38.7585],
                  [113.802648, 38.763166],
                  [113.775547, 38.709949],
                  [113.720728, 38.713218],
                  [113.70225, 38.651551],
                  [113.612939, 38.645942],
                  [113.603084, 38.587024],
                  [113.561816, 38.558483],
                  [113.546417, 38.492936],
                  [113.583374, 38.459671],
                  [113.537794, 38.417952],
                  [113.525475, 38.383245],
                  [113.557504, 38.343359],
                  [113.54457, 38.270569],
                  [113.570439, 38.237202],
                  [113.598772, 38.22733],
                  [113.64312, 38.232031],
                  [113.678844, 38.20523],
                  [113.711489, 38.213695],
                  [113.720728, 38.174656],
                  [113.797105, 38.162894],
                  [113.831597, 38.16854],
                  [113.811271, 38.117707],
                  [113.876561, 38.055059],
                  [113.872249, 37.990471],
                  [113.901198, 37.984811],
                  [113.936307, 37.922993],
                  [113.959097, 37.906468],
                  [113.976959, 37.816696],
                  [114.006524, 37.813386],
                  [114.044712, 37.761834],
                  [113.996669, 37.730128],
                  [113.993589, 37.706932],
                  [114.068118, 37.721608],
                  [114.12848, 37.698409],
                  [114.139567, 37.675676],
                  [114.115545, 37.619761],
                  [114.118625, 37.59084],
                  [114.036705, 37.494037],
                  [114.014531, 37.42468],
                  [113.973879, 37.40329],
                  [113.962792, 37.355734],
                  [113.90243, 37.310052],
                  [113.886416, 37.239095],
                  [113.853155, 37.215269],
                  [113.832213, 37.167594],
                  [113.773083, 37.151855],
                  [113.773699, 37.107004],
                  [113.758301, 37.075497],
                  [113.788482, 37.059739],
                  [113.771851, 37.016745],
                  [113.791561, 36.98759],
                  [113.76138, 36.956034],
                  [113.792793, 36.894796],
                  [113.773083, 36.85506],
                  [113.731815, 36.858891],
                  [113.731815, 36.878521],
                  [113.696707, 36.882351],
                  [113.676381, 36.855539],
                  [113.680692, 36.789907],
                  [113.600004, 36.752995],
                  [113.549497, 36.752515],
                  [113.535946, 36.732373],
                  [113.499606, 36.740527],
                  [113.465113, 36.707908],
                  [113.506997, 36.705029],
                  [113.476816, 36.655114],
                  [113.486671, 36.635427],
                  [113.54457, 36.62342],
                  [113.539642, 36.594116],
                  [113.569823, 36.585947],
                  [113.588917, 36.547974],
                  [113.559968, 36.528741],
                  [113.554425, 36.494589],
                  [113.587069, 36.460904],
                  [113.635729, 36.451277],
                  [113.670221, 36.425278],
                  [113.708409, 36.423352],
                  [113.731199, 36.363135],
                  [113.755221, 36.366026],
                  [113.813119, 36.332285],
                  [113.856851, 36.329392],
                  [113.84946, 36.347711],
                  [113.882104, 36.353977],
                  [113.911054, 36.314927],
                  [113.962792, 36.353977],
                  [113.981887, 36.31782],
                  [114.002828, 36.334214],
                  [114.056415, 36.329392],
                  [114.04348, 36.303353],
                  [114.080437, 36.269585],
                  [114.129096, 36.280199],
                  [114.175907, 36.264759],
                  [114.170364, 36.245938],
                  [114.170364, 36.245938],
                  [114.203009, 36.245456],
                  [114.2104, 36.272962],
                  [114.241197, 36.251247],
                  [114.257827, 36.263794],
                  [114.299095, 36.245938],
                  [114.345291, 36.255591],
                  [114.356378, 36.230492],
                  [114.408117, 36.224699],
                  [114.417356, 36.205868],
                  [114.466015, 36.197658],
                  [114.480181, 36.177855],
                  [114.533152, 36.171575],
                  [114.586739, 36.141133],
                  [114.588587, 36.118414],
                  [114.640326, 36.137266],
                  [114.720398, 36.140166],
                  [114.734564, 36.15563],
                  [114.771521, 36.124699],
                  [114.857752, 36.127599],
                  [114.858368, 36.144516],
                  [114.912571, 36.140649],
                  [114.926737, 36.089403],
                  [114.914419, 36.052155],
                  [114.998186, 36.069572],
                  [115.04623, 36.112613],
                  [115.048693, 36.161912],
                  [115.06286, 36.178338],
                  [115.104744, 36.172058],
                  [115.12507, 36.209731],
                  [115.1842, 36.193312],
                  [115.201446, 36.210214],
                  [115.201446, 36.210214],
                  [115.202678, 36.209248],
                  [115.202678, 36.209248],
                  [115.202678, 36.208765],
                  [115.202678, 36.208765],
                  [115.242098, 36.19138],
                  [115.279055, 36.13775],
                  [115.30246, 36.127599],
                  [115.312931, 36.088436],
                  [115.365902, 36.099074],
                  [115.376989, 36.128083],
                  [115.450902, 36.152248],
                  [115.465068, 36.170125],
                  [115.483547, 36.148865],
                  [115.474923, 36.248352],
                  [115.466916, 36.258969],
                  [115.466916, 36.258969],
                  [115.462605, 36.276339],
                  [115.417025, 36.292742],
                  [115.423185, 36.32216],
                  [115.366518, 36.30914],
                  [115.368982, 36.342409],
                  [115.340033, 36.398307],
                  [115.297533, 36.413239],
                  [115.317243, 36.454166],
                  [115.291374, 36.460423],
                  [115.272895, 36.497476],
                  [115.33141, 36.550378],
                  [115.355431, 36.627262],
                  [115.365902, 36.621979],
                  [115.420105, 36.686795],
                  [115.451518, 36.702151],
                  [115.479851, 36.760187],
                  [115.524815, 36.763543],
                  [115.683727, 36.808117],
                  [115.71206, 36.883308],
                  [115.75764, 36.902453],
                  [115.79706, 36.968945],
                  [115.776734, 36.992848],
                  [115.85619, 37.060694],
                  [115.888219, 37.112254],
                  [115.879596, 37.150901],
                  [115.91224, 37.177132],
                  [115.909777, 37.20669],
                  [115.969523, 37.239572],
                  [115.975682, 37.337179],
                  [116.024341, 37.360015],
                  [116.085935, 37.373809],
                  [116.106261, 37.368577],
                  [116.169087, 37.384271],
                  [116.193109, 37.365723],
                  [116.236224, 37.361442],
                  [116.2855, 37.404241],
                  [116.226369, 37.428007],
                  [116.243, 37.447965],
                  [116.224522, 37.479791],
                  [116.240536, 37.489764],
                  [116.240536, 37.489764],
                  [116.27626, 37.466967],
                  [116.290427, 37.484065],
                  [116.278724, 37.524895],
                  [116.295355, 37.554316],
                  [116.336007, 37.581355],
                  [116.36742, 37.566177],
                  [116.379738, 37.522047],
                  [116.38097, 37.522522],
                  [116.379738, 37.522047],
                  [116.38097, 37.522522],
                  [116.433941, 37.473142],
                  [116.448108, 37.503059],
                  [116.4826, 37.521573],
                  [116.575607, 37.610754],
                  [116.604556, 37.624975],
                  [116.66307, 37.686096],
                  [116.679085, 37.728708],
                  [116.724664, 37.744327],
                  [116.753613, 37.77035],
                  [116.753613, 37.793054],
                  [116.804736, 37.848837],
                  [116.837997, 37.835132],
                  [116.919301, 37.846002],
                  [117.027091, 37.832296],
                  [117.074518, 37.848837],
                  [117.150278, 37.839385],
                  [117.185387, 37.849783],
                  [117.271618, 37.839858],
                  [117.320278, 37.861596],
                  [117.400966, 37.844584],
                  [117.438538, 37.854035],
                  [117.481038, 37.914967],
                  [117.513067, 37.94329],
                  [117.524154, 37.989527],
                  [117.557414, 38.046105],
                  [117.557414, 38.046105],
                  [117.586979, 38.071551],
                  [117.704624, 38.076262],
                  [117.746508, 38.12524],
                  [117.771145, 38.134655],
                  [117.766834, 38.158658],
                  [117.789007, 38.180772],
                  [117.808718, 38.22827],
                  [117.848754, 38.255062],
                  [117.895565, 38.301572],
                  [117.948536, 38.346644],
                  [117.957775, 38.376208],
                  [117.937449, 38.387936],
                  [117.84629, 38.368232],
                  [117.781, 38.373862],
                  [117.730493, 38.424985],
                  [117.72495, 38.457328],
                  [117.678754, 38.477008],
                  [117.644878, 38.52759],
                  [117.68553, 38.539293],
                  [117.638102, 38.54491],
                  [117.639334, 38.626776],
                  [117.55803, 38.613683],
                  [117.47919, 38.616489],
                  [117.432379, 38.601524],
                  [117.368937, 38.564566],
                  [117.25314, 38.556143],
                  [117.238358, 38.580943],
                  [117.258684, 38.608072],
                  [117.258684, 38.608072],
                  [117.213104, 38.639866],
                  [117.213104, 38.639866],
                  [117.183539, 38.61836],
                  [117.183539, 38.61836],
                  [117.150894, 38.617892],
                  [117.109626, 38.584685],
                  [117.070822, 38.608072],
                  [117.055424, 38.639398],
                  [117.068358, 38.680522],
                  [117.038793, 38.688464],
                  [116.95133, 38.689398],
                  [116.948866, 38.689398],
                  [116.950714, 38.689398],
                  [116.95133, 38.689398],
                  [116.950714, 38.689398],
                  [116.948866, 38.689398],
                  [116.877417, 38.680522],
                  [116.858939, 38.741231],
                  [116.794265, 38.744498],
                  [116.794265, 38.744498],
                  [116.746222, 38.754299],
                  [116.737599, 38.784629],
                  [116.75115, 38.831264],
                  [116.723432, 38.852706],
                  [116.722201, 38.896968],
                  [116.708034, 38.931892],
                  [116.72836, 38.975174],
                  [116.754845, 39.003084],
                  [116.754229, 39.034701],
                  [116.754229, 39.034701],
                  [116.783179, 39.05097],
                  [116.783179, 39.05097],
                  [116.812744, 39.05097],
                  [116.812744, 39.05097],
                  [116.871874, 39.054688],
                  [116.912526, 39.110898],
                  [116.91191, 39.111362],
                  [116.91191, 39.111362],
                  [116.912526, 39.110898],
                  [116.909446, 39.150822],
                  [116.870026, 39.153607],
                  [116.855859, 39.215766],
                  [116.881729, 39.225966],
                  [116.881729, 39.225966],
                  [116.87249, 39.291304],
                  [116.889736, 39.338068],
                  [116.870642, 39.357506],
                  [116.829374, 39.338994],
                  [116.818287, 39.3737],
                  [116.840461, 39.378326],
                  [116.839845, 39.413474],
                  [116.876185, 39.43474],
                  [116.832454, 39.435664],
                  [116.785026, 39.465702],
                  [116.820751, 39.482332],
                  [116.819519, 39.528507],
                  [116.78749, 39.554352],
                  [116.808432, 39.576497],
                  [116.812128, 39.615695],
                  [116.79057, 39.595868],
                  [116.748686, 39.619844],
                  [116.709266, 39.618],
                  [116.726512, 39.595407],
                  [116.726512, 39.595407],
                  [116.724048, 39.59264],
                  [116.723432, 39.59264],
                  [116.724048, 39.59264],
                  [116.723432, 39.59264],
                  [116.664918, 39.605552],
                  [116.620571, 39.601863],
                  [116.592237, 39.621227],
                  [116.592237, 39.621227],
                  [116.524484, 39.596329],
                  [116.50847, 39.551122],
                  [116.473361, 39.552968],
                  [116.478289, 39.535431],
                  [116.437637, 39.526661],
                  [116.443796, 39.510041],
                  [116.401912, 39.528046],
                  [116.411767, 39.482794],
                  [116.444412, 39.482332],
                  [116.454883, 39.453226],
                  [116.434557, 39.442597],
                  [116.361876, 39.455074],
                  [116.361876, 39.455074],
                  [116.337854, 39.455536],
                  [116.307057, 39.488337],
                  [116.257782, 39.500344],
                  [116.240536, 39.564041],
                  [116.198652, 39.589412],
                  [116.151841, 39.583416],
                  [116.130283, 39.567732],
                  [116.09887, 39.575113],
                  [116.036044, 39.571884],
                  [116.026189, 39.587567],
                  [115.995392, 39.576958],
                  [115.978146, 39.595868],
                  [115.957204, 39.560812],
                  [115.910393, 39.600479],
                  [115.910393, 39.600479],
                  [115.91532, 39.582955],
                  [115.91532, 39.582955],
                  [115.867893, 39.546507],
                  [115.867893, 39.546507],
                  [115.828473, 39.541431],
                  [115.821081, 39.522968],
                  [115.821081, 39.522968],
                  [115.806299, 39.510041],
                  [115.806299, 39.510041],
                  [115.752712, 39.515581],
                  [115.738545, 39.539585],
                  [115.738545, 39.540046],
                  [115.738545, 39.539585],
                  [115.738545, 39.540046],
                  [115.724995, 39.5442],
                  [115.724995, 39.5442],
                  [115.722531, 39.543738],
                  [115.721299, 39.543738],
                  [115.722531, 39.543738],
                  [115.722531, 39.5442],
                  [115.721299, 39.543738],
                  [115.722531, 39.5442],
                  [115.720683, 39.551122],
                  [115.720683, 39.551122],
                  [115.718835, 39.553891],
                  [115.718835, 39.553891],
                  [115.716988, 39.56035],
                  [115.716988, 39.56035],
                  [115.699125, 39.570039],
                  [115.699125, 39.570039],
                  [115.698509, 39.577881],
                  [115.698509, 39.577881],
                  [115.667712, 39.615234],
                  [115.633836, 39.599557],
                  [115.633836, 39.599557],
                  [115.587024, 39.589873],
                  [115.545756, 39.618922],
                  [115.518039, 39.597252],
                  [115.522351, 39.640124],
                  [115.478619, 39.650723],
                  [115.478619, 39.650723],
                  [115.491554, 39.670074],
                  [115.486626, 39.741899],
                  [115.439815, 39.752022],
                  [115.443511, 39.785601],
                  [115.483547, 39.798477],
                  [115.483547, 39.798477],
                  [115.50572, 39.784222],
                  [115.552532, 39.794799],
                  [115.567314, 39.816407],
                  [115.514344, 39.837549],
                  [115.526046, 39.87568],
                  [115.515575, 39.892212],
                  [115.515575, 39.892212],
                  [115.522967, 39.899099],
                  [115.481083, 39.935819],
                  [115.426264, 39.950502],
                  [115.428728, 39.984443],
                  [115.450286, 39.992697],
                  [115.454597, 40.029825],
                  [115.485394, 40.040364],
                  [115.527278, 40.076092],
                  [115.59072, 40.096239],
                  [115.599959, 40.119583],
                  [115.75456, 40.145663],
                  [115.75456, 40.145663],
                  [115.773654, 40.176307],
                  [115.806299, 40.15344],
                  [115.847567, 40.147036],
                  [115.855574, 40.188652],
                  [115.870356, 40.185909],
                  [115.89869, 40.234354],
                  [115.968907, 40.264045],
                  [115.95166, 40.281852],
                  [115.917784, 40.354405],
                  [115.864197, 40.359422],
                  [115.771806, 40.443734],
                  [115.781045, 40.49336],
                  [115.736082, 40.503372],
                  [115.755176, 40.540221],
                  [115.784741, 40.55841],
                  [115.819849, 40.55932],
                  [115.827857, 40.587504],
                  [115.885139, 40.595229],
                  [115.907929, 40.617493],
                  [115.971986, 40.6025],
                  [115.982457, 40.578868],
                  [116.005247, 40.583868],
                  [116.09887, 40.630665],
                  [116.133979, 40.666536],
                  [116.162928, 40.662451],
                  [116.171551, 40.695582],
                  [116.204812, 40.740035],
                  [116.22021, 40.744115],
                  [116.247311, 40.791707],
                  [116.273181, 40.762703],
                  [116.311369, 40.754996],
                  [116.316912, 40.772221],
                  [116.453651, 40.765876],
                  [116.46597, 40.774487],
                  [116.438253, 40.81934],
                  [116.334159, 40.90443],
                  [116.339702, 40.929303],
                  [116.370499, 40.94377],
                  [116.398216, 40.90624],
                  [116.477057, 40.899907],
                  [116.447492, 40.953715],
                  [116.455499, 40.980828],
                  [116.519557, 40.98128],
                  [116.519557, 40.98128],
                  [116.5676, 40.992574],
                  [116.598397, 40.974503],
                  [116.623034, 41.021026],
                  [116.615643, 41.053076],
                  [116.647672, 41.059394],
                  [116.688324, 41.044501],
                  [116.698795, 41.021477],
                  [116.677853, 40.970888],
                  [116.722201, 40.927495],
                  [116.713577, 40.909858],
                  [116.759773, 40.889954],
                  [116.81336, 40.848319],
                  [116.848468, 40.839264],
                  [116.924229, 40.773581],
                  [116.926692, 40.745022],
                  [116.964881, 40.709647],
                  [117.012308, 40.693767],
                  [117.11209, 40.707379],
                  [117.117018, 40.70012],
                  [117.208177, 40.694675],
                  [117.278394, 40.664267],
                  [117.319662, 40.657911],
                  [117.342451, 40.673799],
                  [117.408973, 40.686961],
                  [117.493973, 40.675161],
                  [117.514914, 40.660181],
                  [117.501364, 40.636569],
                  [117.467487, 40.649738],
                  [117.467487, 40.649738],
                ],
              ],
              [
                [
                  [117.210024, 40.082045],
                  [117.204481, 40.069681],
                  [117.159517, 40.077008],
                  [117.140423, 40.064185],
                  [117.105315, 40.074261],
                  [117.105315, 40.074261],
                  [117.051728, 40.059605],
                  [117.025243, 40.030283],
                  [116.945171, 40.04128],
                  [116.927924, 40.055024],
                  [116.867562, 40.041739],
                  [116.831222, 40.051359],
                  [116.820135, 40.02845],
                  [116.781331, 40.034866],
                  [116.757925, 39.967934],
                  [116.782563, 39.947749],
                  [116.78441, 39.891294],
                  [116.812128, 39.889916],
                  [116.865714, 39.843982],
                  [116.907598, 39.832494],
                  [116.918069, 39.84628],
                  [116.949482, 39.778703],
                  [116.902055, 39.763523],
                  [116.916837, 39.731314],
                  [116.887272, 39.72533],
                  [116.889736, 39.687576],
                  [116.90575, 39.688037],
                  [116.932236, 39.706456],
                  [116.932236, 39.706456],
                  [116.944555, 39.695405],
                  [116.944555, 39.695405],
                  [116.948866, 39.680668],
                  [116.948866, 39.680668],
                  [116.964265, 39.64335],
                  [116.983359, 39.638742],
                  [116.983359, 39.638742],
                  [117.016004, 39.653949],
                  [117.10901, 39.625375],
                  [117.10901, 39.625375],
                  [117.152742, 39.623532],
                  [117.177996, 39.645194],
                  [117.165061, 39.718886],
                  [117.165061, 39.718886],
                  [117.161981, 39.748801],
                  [117.205713, 39.763984],
                  [117.15767, 39.796638],
                  [117.156438, 39.817326],
                  [117.192162, 39.832953],
                  [117.251908, 39.834332],
                  [117.247597, 39.860981],
                  [117.227887, 39.852712],
                  [117.162597, 39.876598],
                  [117.162597, 39.876598],
                  [117.150894, 39.944996],
                  [117.198322, 39.992697],
                  [117.192162, 40.066475],
                  [117.210024, 40.082045],
                ],
              ],
              [
                [
                  [117.784696, 39.376938],
                  [117.765602, 39.400527],
                  [117.699696, 39.407463],
                  [117.673211, 39.386652],
                  [117.668899, 39.412087],
                  [117.614081, 39.407001],
                  [117.601146, 39.419485],
                  [117.570965, 39.404689],
                  [117.521074, 39.357043],
                  [117.536472, 39.338068],
                  [117.594987, 39.349176],
                  [117.669515, 39.322792],
                  [117.670747, 39.357969],
                  [117.74466, 39.354729],
                  [117.784696, 39.376938],
                ],
              ],
              [
                [
                  [118.869365, 39.142932],
                  [118.82009, 39.108576],
                  [118.857662, 39.098824],
                  [118.869365, 39.142932],
                ],
              ],
            ],
          },
        },
      ];
      const drawer = new DrawPolygon(scene, {
        adsorbOptions: {
          data: adsorbFeatures,
        },
      });
      setPolygonDrawer(drawer);
      drawer.enable();

      const layer = new PolygonLayer({
        autoFit: true,
      });
      layer
        .source(featureCollection(adsorbFeatures))
        .color('rgba(255, 255, 255, 0.1)')
        .size(2);
      scene.addLayer(layer);
    });
  }, []);

  return <div id={id} style={{ height: 400, position: 'relative' }} />;
};

export default Demo;
